﻿using System.ComponentModel.DataAnnotations;
using Microsoft.WindowsAzure.StorageClient;
using SimplePoll.Web.DataAccess;

namespace SimplePoll.Web.Models
{
    public class PollAnswer : TableServiceEntity
    {
        string facebookId;

        public PollAnswer() : this(string.Empty)
        {
        }

        public PollAnswer(string facebookId)
            : base(facebookId.Encode(), TableKey.Value)
        {
            this.facebookId = facebookId;
        }

        [Range(1, 3)]
        public int Answer { get; set; }

        public string FacebookId
        {
            get { return facebookId; }
            set
            {
                facebookId = value;
                PartitionKey = value.Encode();
            }
        }

        [Required]
        public string Name { get; set; }
    }
}